<template>
  <div>
    <div class="whiteBg">
      <div class="padding_common padding_bm">
        <!-- 轮播图 -->
        <slide-img :divStyle="0" :bannerArry='banner'></slide-img>
        <!--评论-->
        <div class="commonBox" ref='box' @click="moveTo">
          <img src="../../images/commont.png" alt="">
          <span class="commonNum">{{busInfoDetail.mchtComNum || 0}}条</span>
        </div>
      </div>
      <div class="merInfo">
        <div class="card_name mcht_title">
          {{busInfoDetail.mchtName}}
          <!--<span class='collect' @click="collection">-->
                <!--<svg v-show="!collectStatus" aria-hidden="true" class="icon">-->
                    <!--<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucang-"></use>-->
                <!--</svg>-->
                <!--<svg v-show="collectStatus" aria-hidden="true" class="icon color_ec">-->
                    <!--<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucangfuben"></use>-->
                <!--</svg>-->
            <!--</span>-->
        </div>
        <div class="coupon_info_item">
          <span class="perMoney left">￥{{busInfoDetail.mchtPer || 0}}/人</span>
          <p class="star_con">
            <star :couponComScore="busInfoDetail.mchtComScore"></star>
          </p>
          <span class="info_pad">{{busInfoDetail.mchtComNum || 0}}</span>
        </div>
      </div>
      <div class="mer_position">
        <a :href="telephone" class="phoneBtn">
          <img src="../../images/tel.png" alt="">
        </a>
        <i class="icon iconfont icon-location left"></i>
        <p @click="getPosition"><span>{{busInfoDetail.mchtAddr}}</span></p>
      </div>
      <div class="pay_bill">
        <div class="right">
          <a @click="scan(busInfoDetail.mchtId)" class="mgt1"><span>买单</span></a>
        </div>
        <div class="pay_bill_title">
          <span>买单</span>
          <p>扫一扫商户收款二维码买单。安全方便，省时省力</p>
        </div>
      </div>
      <!--改版 服务信息-->
      <div class="service_info">
         <span class="title">服务信息</span>
         <span class="info" @click="forMore">营业时间、服务设施、分店信息<i class="iconfont icon-right"></i></span>
      </div>
    </div>

    <div class="whiteBg mgt10 business_infor">
      <div class="discount_info" v-if="couponLength>0" style="background: #ffffff;">
        <span class="left">电子券优惠信息</span>
        <a class="right" @click="lookOther(businessInfo)"><span style="color: #666666;">查看全部</span><i class="iconfont icon-right"></i></a>
      </div>
      <div>
        <div class="whiteBg coupon_dtl_coupon coupon_dtl_coupon_new" v-for="couponItem in businessInfo.couponList" @click="JumpOrder(couponItem)">
          <div class="couponDiv" style="margin: 0;">
            <coupon-denomination :item="couponItem"></coupon-denomination>
          </div>
          <div class="card_info card_info_new">
            <div class="card_name">
              {{couponItem.name}}
              
            </div>
            <div class="coupon_info_item">
              <p class="star_con">
                <star :couponComScore="couponItem.comScore"></star>
              </p>
              <p class="info_pad" style="margin-bottom: .6rem;">{{couponItem.comNum}}
              </p>
              <img class="otherIcon" v-if="couponItem.promAppro=='buy'" src="../../images/cashIcon.png"/>
              <img class="otherIcon" v-if="couponItem.couponTypes=='third'" src="../../images/dui.png"/><p class="couponNum">剩余{{couponItem.surplusnum}}张</p>
            </div>        
          </div>
          <div class="priceDiv">
          	<p>{{couponItem.promAppro=='buy'?couponItem.cash:couponItem.valuation}}</p>
          	<span>{{couponItem.promAppro=='buy'?'元':'芸券'}}</span>
          </div>
          <div v-if="couponItem.promAppro=='buy'" class="coupon_btn" style="background:rgb(243,72,168);">购买</div>
          <div v-else class="coupon_btn">兑换</div>
        </div>
      </div>
      <!-- 优惠活动信息 -->
      <div class="shop_activity" v-if="activityList.length>=1">
        <div class="discount_info">
          <span class="left">优惠活动</span>
          <div style="float: right;width: 1.5rem;"><div class="swiper-pagination"></div></div>
         
        </div>
        	<!--轮播-->
	    	<div style="height: 10rem;" v-if="activityList.length>1">
	    		 <swiper :options="swiperOption" ref="mySwiper">
                <!-- slides -->
                <swiper-slide v-for="couponItem in activityList" :key="couponItem">
                    <div class="actCoupon" @click="actBtn(couponItem)">
                    	<div  class="actCoupon_content">
                    		<div class="actCoupon_content_pic"></div>
                    		<h3 class="activity_header">{{couponItem.act.actName}}</h3>
                    		<div class="colorGray">
                    			<span v-if="couponItem.coupon.type=='rebate'">面值：<span>{{couponItem.coupon.denomination/10 || denomination(couponItem.coupon.couponType || couponItem.coupon.type)}}折</span></span>
		                        <span v-else>面值：<span>￥{{couponItem.coupon.denomination || denomination(couponItem.coupon.couponType || couponItem.coupon.type)}}</span></span>
                    		</div>
                    		<div class="colorGray" style="margin-top: .5rem;">
                    			有效期：{{couponItem.act.actBegDate|endtimeStampt}}-{{couponItem.act.actEndDate|endtimeStampt}}
                    		</div>
                    	</div>
                       
                    </div>
                    
                </swiper-slide>
                
            </swiper>
           
	    	</div>
	    	<!--只有一个-->
	    	<div style="height: 10rem;" v-if="activityList.length==1">
                <!-- slides -->
                <div v-for="couponItem in activityList" :key="couponItem">
                    <div class="actCoupon" @click="actBtn(couponItem)" style="width: 96%;">
                    	<div  class="actCoupon_content">
                    		<div class="actCoupon_content_pic"></div>
                    		<h3 class="activity_header">{{couponItem.act.actName}}</h3>
                    		<div class="colorGray">
                    			<span v-if="couponItem.coupon.type=='rebate'">面值：<span>{{couponItem.coupon.denomination/10 || denomination(couponItem.coupon.couponType || couponItem.coupon.type)}}折</span></span>
		                        <span v-else>面值：<span>￥{{couponItem.coupon.denomination || denomination(couponItem.coupon.couponType || couponItem.coupon.type)}}</span></span>
                    		</div>
                    		<div class="colorGray" style="margin-top: .5rem;">
                    			有效期：{{couponItem.act.actBegDate|endtimeStampt}}-{{couponItem.act.actEndDate|endtimeStampt}}
                    		</div>
                    	</div>
                       
                    </div>
 </div>
           
	    	</div>
      </div>
    </div>
    <div v-if="docItem" class="whiteBg mgt10 recommend_cont" @click="jumpFind(docItem.docId,docItem.picUrl)">
      <h3 class="recommend_title">为您推荐<a href="javascript:;"
                                         @click.stop="$router.push({path:'/findDetailMore',query:{mchtId:busInfoDetail.mchtId}})"
                                         class="iconfont icon-right right"></a></h3>
      <div class="find_page">
        <a>
          <div class="recommend_img">
            <img :src="docItem.picUrl"/>
          </div>
          <div class="item_cont">
            <h3>{{docItem.docTitle}}</h3>
            <p class="doc_cont">{{docItem.docDesc}}</p>
            <div class="find_time">
              <span class="left">{{docItem.crtTime, 2 | strDate}}</span>
              <em class="right iconfont icon-guanzhu"><span class="right_num">{{docItem.visitCount}}</span></em>
            </div>
            <div class="clear"></div>
          </div>
        </a>
      </div>

    </div>
    <div v-if="!replyShopNum.mchtComNum||replyShopNum.mchtComNum==0" class="whiteBg mgt10 no_comment">暂无评论</div>
    <div v-show="replyShopNum.mchtComNum>0" ref="commBox" class="whiteBg mgt10" @click="hide">
      <a @click="replyJump(businessInfo)" class="aboutComments">
        <i class="iconfont icon-right right"></i>大家怎么说 ({{replyShopNum.mchtComNum || 0}})
      </a>
      <div class="coupon_dtl_tag">
        <p :class="indexCom==3?'tag_all':'tag_good'" @click="tabCom(3)">全部({{replyShopNum.mchtComNum || 0}})</p>
        <p :class="indexCom==0?'tag_all':'tag_good'" @click="tabCom(0)">满意({{replyShopNum.mchtComStar45Num || 0}})</p>
        <p :class="indexCom==2?'tag_all':'tag_bad'" @click="tabCom(2)">不满意({{replyShopNum.mchtComStar12Num || 0}})</p>
        <p :class="indexCom==1?'tag_all':'tag_good'" @click="tabCom(1)">一般({{replyShopNum.mchtComStar3Num || 0}})</p>
        <p :class="indexCom==4?'tag_all':'tag_good'" @click="tabCom(4)">有图({{replyShopNum.mchtPicNum || 0}})</p>
      </div>
    </div>
    <comments v-show="replyShopNum.mchtComNum>0" @clickPub="publishFocus" @clickBlur="hide" :replyStyle="1"
              :commentList="shopComments" :mchtId="busInfoDetail.mchtId" :allStatus="allStatus"></comments>
    <a v-if="replyShopNum.mchtComNu>0" @click="replyJump(businessInfo)" class="viewAllCom all_comment"><i
        class="iconfont icon-right right"></i>查看全部券友评论</a>
    <!-- 评论框 -->
    <div :class="boxStatus?'comment_box':'comment_box db'">
      <input id="inputId" ref="inputId" @focus="inputFixed" v-model="commentCont" class="left" type="text"
             placeholder="写点评论吧"/>
      <span @click="publish()" class="comment_box_btn right">发表</span>
    </div>
    <modal v-if="actShow">
    	<div class="modal_act">
    		<div class="modal_act_div">
    			<img class="modal_act_img" src="../../images/buyDiscount.png"/>
    		</div>
    		<div class="modal_act_coupon">
    			<div class="couponDiv">
            <coupon-denomination :item="actShowArr"></coupon-denomination>
          </div>
          <div class="modal_act_coupon_data">
          	 <h3>{{actShowArr.name}}</h3>
          <div class="modal_act_coupon_value"><span v-if="actShowArr.type=='rebate'">面值：<span class="color_red">{{actShowArr.denomination/10 || denomination(actShowArr.type)}}折</span></span>
		                        <span v-else>面值：<span class="color_red">￥{{actShowArr.denomination || denomination(actShowArr.type)}}</span></span></div>
          <div class="modal_act_coupon_time">	有效期：{{actShowArr.validatyBegin|endtimeStampt}}-{{actShowArr.validatyEnd|endtimeStampt}}</div>
          </div>
         
    		</div>
    		<div>
    			<h4 class="modal_act_dscTxt">活动详情:</h4>
    			<div class="modal_act_dscContent">{{actDsc}}</div>
    		</div>
    	</div>
    

    	<div style="height: 3rem;"  @click="actShow=false" ><div class="x"><icon iconName="#icon-shanchu"></icon></div></div>
    </modal>
  </div>
</template>
<script>
	require('swiper/dist/css/swiper.css')
  import slideImg from '../../componentes/global/slideImg.vue'
  import comments from '../../componentes/global/comments.vue'
  import star from '../../componentes/global/star.vue'
  import couponNum from '../../componentes/global/couponNum.vue'
  import getData from '../../service/getData.js'
  import getData2 from '../../service/getData2.js'
  import getData4 from '../../service/getData4.js'
  import * as types from '../../vuex/types.js'
  import * as types1 from '../../vuex/appendType.js'
  import {Storage} from 'src/utils/storage.js'
  import {mapState} from 'vuex'
  import {Toast, Indicator} from 'mint-ui'

  export default {
    name: 'merchant-detail',
    data() {
      return {
        replyShopNum: '',
        businessInfo: '',
        busInfoDetail: '',
        facil: [],
        telephone: '',
        docItem: '',
        couponLength: '',
        indexCom: 3,
        picture: '',
        allStatus: true,
        boxStatus: false,
        commentCont: '',
        commId: '',
        banner: [],
        activity: [],
        distanceInfo: '',
        distFlag: '',
        collectStatus: false,
        activityList: [],
        swiperOption: {
          autoplay: 3000,
          direction : 'horizontal',
          pagination : '.swiper-pagination',
          loop:false,
          width:window.innerWidth*0.95,
          preventClicks  : false,
        },
        actShow:false,
        actShowArr:[],
        actDsc:'',
        timer:'',
      }
    },
    components: {
      comments,
      star,
      couponNum,
      slideImg
    },
    methods: {
      replyJump: function (params) {
        var replyStyle = 1;
        this.$router.push({
          'path': '/commentAll/' + this.$route.query.mchtId + '/' + params.couponId + '/' + 1
        });
      },
      //跳转买单
      scan: function (mchtId) {
        let me = this;
        new Promise((resolve, reject) => {
          wx.scanQRCode({
            needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
              var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
              resolve(result);
            }
          });
        }).then(rep => {
          let scanMchtId
          let queryObject = {};
          if (rep.indexOf('?') >= 0) {
            rep.split('?')[1].split('&').forEach(data => queryObject[data.split('=')[0]] = data.split('=')[1]); // 获取url上的每个参数集成在jumpPageObject对象
          }
          if (rep.indexOf('o=') === -1) {
            scanMchtId = rep.substr(rep.indexOf("m=") + 2)
          } else {
            scanMchtId = rep.slice(rep.indexOf("m=") + 2, rep.indexOf("&t="))
          }
          let obj_scene = rep.substr(rep.indexOf("sc="), 5)
          if (mchtId.toString() != scanMchtId.toString()) {
            Toast({
              message: '商户不一致',
              duration: 1000
            });
            return
          } else {
            if (rep.indexOf('payIndex') >= 0) { // 反扫
              me.$store.commit('changeState', true)
              me.$router.push({
                'name': 'payIndex',
                query: queryObject
              });
            } else if (rep.indexOf('positiveScan') >= 0) { // 正扫
              me.$store.commit('changeState', true)
              me.$router.push({
                'name': 'positiveScan',
                query: queryObject
              });
            } else {
              Toast({
                message: "二维码不正确" + obj_scene,
                duration: 800
              });
            }
          }
        });
      },
      getPosition() {
        let me = this;
        var po_array = me.businessInfo.mchtSearch.position.split(" ");
        wx.openLocation({
          latitude: parseFloat(po_array[1]), // 纬度，浮点数，范围为90 ~ -90
          longitude: parseFloat(po_array[0]), // 经度，浮点数，范围为180 ~ -180。
          name: me.businessInfo.mchtSearch.name || me.businessInfo.mcht.mchtName, // 位置名
          address: '', // 地址详情说明
          scale: 12, // 地图缩放级别,整形值,范围从1~28。默认为最大
          infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
        });
      },
      //跳详情
      jumpFind: function (id, img) {
        this.$router.push({
          'path': '/findDetail',
          query: {
            docId: id,
            img: img
          }
        });
      },

      // 查看其他分店
      lookbranth: function (info) {
        this.$router.push({
          'path': '/businessOther/' + info.mcht.mchtId + '/' + info.mcht.upperMchtId
        })
      },
      //查看其他优惠
      lookOther: function (info) {
        console.log(info);
        Storage.set("oneCouponMer", info, true);
        this.$router.push({ 
          'path': '/businessCoupon/' + info.mcht.mchtId ,query:{'mchtComNum':info.mcht.mchtComNum,'noMchtSwiper':this.$route.query.noMchtSwiper} 
        });
        // this.$router.push({'name':'businessOther',params:{ mchtId: id}})
      },
      //挂单电子券
      JumpOrder: function (params) {
        Storage.set("couponInfo", params);
        if (params.promAppro == 'buy') {
          if (params.surplusnum == 0) {
            Toast({
              message: "电子券已售完不可购买",
              duration: 1000
            });
            return
          } else {
            this.$router.push({
              name: 'couDetail',
              query: {
                type: 'noExchange',
                couponId: params.couponId,
                mchtId: params.mchtId,
                seq: params.seqNo || '',
                usrId: params.usrId || '',
                usrPicId: '',
                buy: true,
                surplusnum: params.surplusnum
              }
            });
          }

        } else {
//        this.$router.push({
//          name: 'couDetail',
//          query: {
//            type: 'noExchange',
//            couponId: params.couponId,
//            mchtId: params.mchtId,
//            seq: params.seqNo || '',
//            usrId: params.usrId || '',
//            usrPicId: '',
//            surplusnum: params.surplusnum
//          }
//        });
          
          
           //赋值，跳转兑换券页面
	 	this.$store.commit('changeState', true)
	 	getData4.findSeqno({couponId: params.couponId,mchtId:params.mchtId}).then(res=>{
	 		if(res.content.list.length!=0){
	 			params.id=res.content.list[0].id
	 			params.usrId=res.content.list[0].usrId
	 				Storage.set('couponInfo', params, false);
			        this.$router.push({
			          path: "/exchange",
			          query: {
			            surplusnum: params.sellNum
			          }
			      })
	 		}else{
	 			  this.$router.push({
		          name: 'couDetail',
		          query: {
		            seq:  '',
		            couponId: params.couponId,
		            mchtId: params.mchtId,
		            usrPicId: '',
		            usrId: res.usrId || res.sellUsr || '' // 挂单用户ID
		          }
		        });
	 		}
	 	})
       
      
        }

      },
      // 查看优惠活动详情
      lookActivity: function (info) {
        this.$router.push({
          path: '/activityList',
          query: {
            mchtId: info.mchtId
          }
        });
      },
      //关于商户评论列表
      shopList: function () {
        var me = this;
        // this.$store.dispatch("shopComments",{mchtId:me.param.mchtId,data:{"commStar": me.indexCom,"hasPic": me.picture,"mchtId":me.$route.query.mchtId}}).then(function(rep){
        //         me.replyShopNum=rep.content;
        //     })
        this.$store.dispatch("shopComments", {
          mchtId: me.$route.query.mchtId,
          data: {
            "commStar": me.indexCom,
            "hasPic": me.picture,
            "mchtId": me.$route.query.mchtId,
          }
        }).then(function (rep) {
          me.replyShopNum = rep.content;
        }).catch(function (rep) {
        });
      },
      // 评论满意度切换
      tabCom(num) {
        var _this = this;
        this.$store.commit(types.SHOP_COMMENTS); //初始化列表
        this.$store.commit("COUPON_PAGES"); //评论分页初始化
        this.indexCom = num;
        if (num == 4) {
          this.picture = 3;
        } else {
          this.picture = '';
        }
        this.shopList();
        setTimeout(function () {
          _this.$refs.commBox.scrollIntoView(true);
        }, 600)
      },
      //点评论聚焦
      publishFocus: function (data) {
        this.commId = data.commId;
        this.commentUsrd = data.usrId;
        this.boxStatus = true;
        document.getElementById('inputId').focus();
      },
      // 点评论失焦
      hide: function () {
        this.boxStatus = false
      },
      // input聚焦
      inputFixed: function () {
        let me = this;
        let inputEl = me.$refs.inputId;
        setTimeout(function () {
          inputEl.scrollIntoView(true);
        }, 100)
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
          setTimeout(function () {
            window.scrollTo(0, document.body.scrollHeight);
          }, 500)
        }
      },
      //发表
      publish: function (e) {
        var me = this;
        if (me.commentCont == '') {
          Toast({
            message: '内容不能为空',
            duration: 800
          });
          return false;
        }
        if (me.commentUsrd == me.userInfo.usrId) {
          Toast({
            message: '不能回复自己',
            duration: 800
          });
          return;
        }
        var baseComm = Base64.encode(me.commentCont);
        getData2.commentReply({
          'method': 'post',
          data: {
            commId: me.commId,
            dsc: baseComm
          }
        }, me.userInfo.usrId).then(rep => {
          if (rep.respCode == '00') {
            Toast({
              message: '回复成功',
              duration: 800
            });
            me.commentCont = ''
            me.boxStatus = false;
            if (me.indexTab == 0) {
              me.$store.commit("COUPON_PAGES");
              me.couponList();
            } else if (me.indexTab == 1) {
              me.$store.commit("COUPON_PAGES");
              me.shopList();
            }

          } else {
            Toast({
              message: '回复失败',
              duration: 800
            });
            me.boxStatus = false;
          }
        })
      },
      //商户广告
      shopBanner: function () {
        var me = this;
        getData2.shopBanner({
          method: 'post',
          data: {
            "aoData": "",
            "mchtId": me.$route.query.mchtId,
            "state": ""
          }
        }).then(function (rep) {
          // console.log(1111)
          me.banner = rep.content.list;
        })
      },
      scpoe: function (value) {
        let type = value.substring(0, 1)
        let newVal
        // I: 包括  T: 不包括
        if (type === 'I') {
          newVal = `包括${value.substring(1, value.length)}`
        } else {
          newVal = `除${value.substring(1, value.length)}外`
        }
        return newVal
      },
      actBtn: function (item){
      	let me=this
      	me.actShowArr=item.coupon
      	me.actDsc=item.act.actDsc
      	me.actShow=true
      	
      	console.log(item)
      },

     //判断有无收藏
     isCollected: function () {
            var me = this;
            var collectStorage = {
                collectList: [],
                listId: [],
                usrId: ''
            };
            var collectArry = Storage.get("collect_info");
            // var couponCont = Storage.get("couponInfo");
            console.log(collectArry);

            if (collectArry) {
                // if (me.param.seqNo) {
                //     // console.log(collectArry.listId)
                //     for (var i = 0; i < collectArry.listId.length; i++) {
                //         if (me.param.seqNo == collectArry.listId[i]) {
                //
                //             me.collectStatus = true;
                //             me.collectIndex = i;
                //             return;
                //         }
                //     }
                //
                //     me.collectStatus = false;
                // } else if (me.param.couponId) {
                //     var mosaic = me.param.mchtId + ',' + me.param.couponId;
                //     for (var i = 0; i < collectArry.listId.length; i++) {
                //         if (mosaic == collectArry.listId[i]) {
                //             me.collectStatus = true;
                //             me.collectIndex = i;
                //             return;
                //         }
                //     }
                //     me.collectStatus = false;
                // }
            } else {
                me.collectStatus = false;
            }
        },
      // 收藏
      collection: function () {
            let me = this;
            var collectArry = Storage.get("collect_info") || {
                collectList: [],
                listId: [],
                usrId: ''
            };
            if (!collectArry.usrId) {
                collectArry.usrId = Storage.get("usrId", false);
            }
            if (!this.collectStatus) {
                this.collectStatus = true;
                Toast({
                    message: '收藏成功',
                    duration: 800
                });

                collectArry.collectList.unshift(me.couponParam);
                if (me.param.seqNo) {
                    collectArry.listId.unshift(me.couponParam.seqNo);
                } else {
                    var mosaic = me.couponParam.mchtId + ',' + me.couponParam.couponId;
                    collectArry.listId.unshift(mosaic);
                }
                Storage.set("collect_info", collectArry)
            } else {
                this.collectStatus = false;
                Toast({
                    message: '取消收藏',
                    duration: 800
                });
                // console.info(me.collectIndex);
                collectArry.collectList.splice(me.collectIndex, 1)
                collectArry.listId.splice(me.collectIndex, 1)
                Storage.set("collect_info", collectArry)
            }
        },
        //点击头部评论滚动到下面评论
        moveTo:function(){
            this.$refs.commBox.scrollIntoView(true);
        },
        //查看服务信息
        forMore: function () {
            this.$router.push({
                'path': '/serviceInfo',
                 query:{ mchtId:this.busInfoDetail.mchtId,'mchtComNum':this.busInfoDetail.mchtComNum,'noMchtSwiper':this.$route.query.noMchtSwiper}
            });
        },
    },
    computed: {
      ...mapState({
        userInfo: state => state.user.userInfo,
        shopComments: state => state.coupon.shopComments,
        position: state => state.coupon.position,
      }),
       swiper() {
                return this.$refs.mySwiper.swiper
            }
    },
    created: function () {
    	
      this.$store.commit('changeState', true); // 请求加载动画
      var me = this;
      this.shopBanner();
      this.$store.commit(types.SHOP_COMMENTS); //初始化列表
      this.$store.commit("COUPON_PAGES"); //评论分页初始化
      //商户信息
      var cityGet = Storage.get("city", true);

      getData.mchtNew({
        method: 'post',
        data: {
          cityName: cityGet,
          position: me.position
        },
        mchtId: me.$route.query.mchtId
      }).then(rep => {
        if (rep.content.mchtSearch) {
          me.distanceInfo = rep.content.mchtSearch.distance;
          me.distFlag = rep.content.flag || '';
        }
      });

      getData.mchtNo({
        mchtId: me.$route.query.mchtId
      }).then(rep => {

        me.businessInfo = rep.content;
        me.busInfoDetail = rep.content.mcht;
        me.facil = rep.content.mcht.mchtFacil.split("");
        me.telephone = 'tel:' + rep.content.mcht.mchtTel1;
        me.docItem = rep.content.docList[0];
        me.couponLength = rep.content.couponList.length;
      });
      //商户活动信息
      // this.$store.commit(types1.ACTIVITY);
      // this.$store.commit(types1.ACTIVITY_PAGE,1);
      // this.$store.dispatch('businessActivity',{method:'post',data:{"mchtId":10000050}}).then(function(rep){})
      getData2.getShopActivity({
        method: 'post',
        data: {
          "aoData": "",
          "mchtId": me.$route.query.mchtId,
          "money": ''
        }
      }).then(rep => { //me.$route.query.mchtId
        if (rep.respCode = '00') {
          if (rep.content.list) {
            if (rep.content.list.length >= 1) {
              me.activityList=rep.content.list
            }
          }
        } else {
          Toast({
            message: rep.errorInfo,
            duration: 1000
          });
        }

      })
      this.shopList();
      //判断有无收藏
      this.isCollected();
      this.$nextTick(() => {
        window.scrollTo(0, 0);
      })
    },
    beforeRouteLeave(to, from, next) {

      next()
    },
    updated:function(){
      this.$nextTick(function(){
      	if(this.$route.query.moveTo){
      		this.moveTo()
      	}
      
      })
    }
  }
</script>
<style scoped lang="scss">
.colorGray{
	color: rgb(102,102,102)
}
	.actCoupon{
		height: 100%;
		background: url(../../images/act_border.png);
		padding: .5rem;
		margin-left:.5rem ;
		background-size: 100%;
		
	}

	.actCoupon_content{
		height: 100%;
		background: #FFFFFF;
		width: 100%;
		overflow: hidden;
	}
	.activity_header{
		font-size: 1.5rem;
		margin: 1.3rem 0 .5rem 0;
	}
	.actCoupon_content_pic{
		width:6rem;
		height: 6rem;
		margin: 1.5rem 1rem;
		float: left;
		background: url(../../images/buyDiscount.png);
		background-size: 100%;
	}
	.swiper-container {
		height: 10rem;
    }
  .service_facilities,
  .shop_service_timer {
    overflow: hidden;
  }

  .mer_position p {
    display: flex;
    color:rgb(102,102,102);
  }

  .mer_position p span {
    max-height: 2.4rem;
    /* display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; */
    overflow: hidden;
  }
  .merInfo .info_pad {
    vertical-align: -1px;
  }

  /*.info_pad{line-height: 1.8rem;}*/

  .pay_bill_title em {
    font-style: normal;
  }

  .mgt1 {
    margin-top: 1rem;
  }

  /*活动优惠*/

  .shop_activity .discount_info {
    padding: 0 0.75rem 0 1rem;
    height: 3.25rem;
  }

  .activity_item {
  }

  .activity_item .coupon_dtl_coupon {
    height: 7rem;
  }

  .activity_bg_blue {
    background: url(../../images/activity_bg_blue.png) 0 0 no-repeat;
  }

  .activity_bg_yellow {
    background: url(../../images/activity_bg_yellow.png) 0 0 no-repeat;
  }

  .activity_bg_green {
    background: url(../../images/activity_bg_green.png) 0 0 no-repeat;
  }

  .activity_bg_orange {
    background: url(../../images/activity_bg_orange.png) 0 0 no-repeat;
  }

  .activity_bg_purple {
    background: url(../../images/activity_bg_purple.png) 0 0 no-repeat;
  }

  .shop_activity {
    background-color: #F5F5F5;
    padding-bottom: 1rem;
  }

  .activity_item .coupon_dtl_coupon {
    padding: 0.2rem 0.83rem 0.2rem 1rem;
    background-size: 100% 100%;
    margin-bottom: 0;
    border-bottom: none;
  }

  .activity_item .card_info {
    background-color: #fdfdfd;
    border-radius: 3px;
    margin: 0.5rem 0 0 3.93rem;
    padding: .4rem 0 0 .5rem;
    height: calc(100% - 1.33rem);
  }

  .activity_item .coupon_info_item {
    line-height: 1.6;
    margin-top: 0.33rem;
    padding: 0 0.5rem 0 0;
  }

  .color_red {
    color: #ee3155;
  }

  .activity_factor {
    margin: 0 0.667rem;
    text-align: right;
    font-size: 0.8rem;
    color: #fff;
    height: 1.8rem;
    line-height: 1.8rem;
    background-color: #5898b3;
    padding-right: 1rem;
  }

  .activity_des {
    margin: 0 0.667rem;
    font-size: 0.8rem;
    color: #666;
    padding: 1rem 0;
  }

  .scpoe {
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
  }

/*新页面更改样*/
.coupon_dtl_coupon_new{
	border-top: 1px solid #F5F5F5;
	margin: 0;
	padding: 1rem;
	position: relative;
}
 .card_info_new{
 	padding: 0 0 0 .667rem;
 	width: 13rem;
 	float: left;
 	overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  .card_name{
  	font-size: 1.125rem;
  	color: rgb(68,68,68);
  }
  .couponNum{
  	font-size: 0.75rem;
  	color: rgb(153,153,153);
  }
 }
 .otherIcon{
 	width: 1rem;
 	height: 1rem;
 	float: left;
 	margin-right: .3rem;
 }
 .priceDiv{
 	position: absolute;
 	right:4rem;
 	top: 1.7rem;
 	width: 5rem;
 	text-align: center;
 	& p{
 		font-size:1.5rem;
 		color: rgb(237,88,143);
 		position: relative;
 		top: .2rem;
 	}
 	& span{
 		font-size:0.75rem;
 		color: rgb(102,102,102)
 	}
 }
 .coupon_btn{
 	font-size:0.875rem ;
 	float: right;
 	height: 2rem;
 	background: rgb(248,89,124);
 	color: #ffffff;
 	line-height: 2rem;
 	width: 5rem;
 	position: absolute;
 	right:-1.5rem;
 	top: 2.5rem;
 	text-indent: 1rem;
 	border-top-left-radius:1rem;
 	border-bottom-left-radius:1rem;
 }
 /*弹框活动说明*/
 .modal_act{
 	margin: 10rem auto 0;
 	min-height: 18rem;
 	background: white;
 	width: 80%;
 	border-radius: 1rem;
 	padding: 0rem 1rem 1rem;
 }
 .modal_act_div{
 	text-align: center;
 	height: 3rem;
 }
 .modal_act_img{
 	width: 7rem;
 	position: relative;
 	top: -3.5rem;
 }
 .modal_act_coupon{
 	height: 7rem;
 	border-bottom: 1px dashed #F5F5F5;
 }
 .modal_act_coupon_data{
 	text-indent: 1rem;
 	overflow: hidden;
 	& h3{
 		font-size: 1rem;
 		margin: .5rem 0 .5rem;
 		color: rgb(51,51,51);
 	}
 	.modal_act_coupon_value{
 		font-size: 0.75rem;
 		color: rgb(102, 102, 102);
 	}
 	.modal_act_coupon_time{
 		font-size: 0.75rem;
 		margin-top:.5rem ;
 		color: rgb(102, 102, 102);
 	}
 }
 .x{
 	color: rgb(237, 88, 143);
 	border-radius: 50%;
 	border: 1px solid rgb(237, 88, 143);
 	width: 1.25rem;
 	height: 1.25rem;
 	text-align: center;
 	line-height: 1.25rem;
 	margin: 1rem auto;
 }
 .modal_act_dscTxt{
 	margin: 1rem 0;
 	color: rgb(51,51,51);
 }
 .modal_act_dscContent{
 	color: rgb(51,51,51);
 	font-size: 0.875rem;
 }
  /*改版样式*/
  .swiperCon{
    height:10.7rem;
  }
  .padding_common{
    padding:0;
  }
  .mcht_title{
    font-size:1.35rem;
    font-weight:400;
    color:rgb(68,68,68);
  }
  .collect{
    position:absolute;
    right:1rem;
    font-size:1.55rem;
  }
  .collect svg.icon{
    vertical-align:-.3rem;
  }
  .perMoney{
    color:rgb(68,68,68);
    font-size:1rem;
    line-height:2.2rem;
  }
  .star_con{
    padding-left:.2rem;
  }
  .commonBox{
    width:4.55rem;
    height:1.5rem;
    position:absolute;
    top:1rem;
    right:0;
    background:rgba(237,77,138,0.9);
    border-top-left-radius:100px;
    border-bottom-left-radius:100px;
  }
  .commonBox img{
      padding-left:.7rem;
      vertical-align:-.2rem;
      width:1rem;
      height:1rem;
      line-height:1rem;
  }
  .commonNum{
    color:#fff;
    font-size:.8rem;
    padding-left:.2rem;
    line-height:1.5rem;
  }
  .service_info{
    height:3.3rem;
    line-height:3.3rem;
    margin: 0 .667rem;
    border-top:1px solid #f0f0f0;
  }
  .title{
    color: rgb(51,51,51);
    font-weight: 400;
    font-size: .85rem;
    padding-left:.5rem;
  }
  .info{
    float:right;
    font-size:.85rem;
    color:rgb(102,102,102);
  }
  .service_info i{
    margin-left: 2px;
    color:rgb(102,102,102);
    font-size:.85rem;
    vertical-align: .5px;
  }
  .find_page{
    padding:.1rem .889rem 0;
  }
  .right_num{
    color:rgb(74,74,74);
  }
</style>
<!-- 修改组件时要全局修改 -->
<style>
  .activity_item .couponDiv {
    background: transparent;
  }

  .activity_item ._num {
    margin-top: 0.5rem;
  }

  .activity_item ._num_price span {
    font-size: 2rem;
    line-height: 1.2;
  }

  .activity_item .zhekou span {
    font-size: 1.2rem;
  }
</style>
